home *** CD-ROM | disk | FTP | other *** search
- /*
- * Source machine generated by GadToolsBox V2.0
- * which is (c) Copyright 1991-1993 Jaba Development
- *
- * GUI Designed by : -- Unnamed --
- */
-
- #include <exec/types.h>
- #include <intuition/intuition.h>
- #include <intuition/classes.h>
- #include <intuition/classusr.h>
- #include <intuition/imageclass.h>
- #include <intuition/gadgetclass.h>
- #include <libraries/gadtools.h>
- #include <graphics/displayinfo.h>
- #include <graphics/gfxbase.h>
- //#include <proto/exec.h>
- //#include <proto/intuition.h>
- //#include <proto/gadtools.h>
- //#include <proto/graphics.h>
- //#include <proto/utility.h>
- #include <string.h>
- #include <stdio.h>
- #include <stdlib.h>
-
- #include <clib/exec_protos.h>
- #include <clib/intuition_protos.h>
- #include <clib/gadtools_protos.h>
- #include <clib/utility_protos.h>
- #include <clib/graphics_protos.h>
-
- #include "oct.h"
-
- extern struct IntuitionBase *IntuitionBase;
- extern struct GfxBase *GfxBase;
- extern struct Library *UtilityBase;
- extern struct Library *GadToolsBase;
- extern struct Library *DiskfontBase;
- extern struct Library *AslBase;
- extern struct Library *IFFParseBase;
- extern struct Library *DOSBase;
-
- int oct=0;
-
- extern struct Screen *pubscreen;
-
- APTR VisualInfo4 = NULL;
- struct Window *Project0Wnd4 = NULL;
- struct Gadget *Project0GList4 = NULL;
- struct Gadget *Project0Gadgets4[2];
- UWORD Project0Left4 = 232;
- UWORD Project0Top4 = 50;
- UWORD Project0Width4 = 295;
- UWORD Project0Height4 = 76;
- UBYTE *Project0Wdt4 = (UBYTE *)"Sample settings";
-
- struct TextAttr topaz84 = {
- ( STRPTR )"topaz.font", 8, 0x00, 0x01 };
-
- struct IntuiText Project0IText4[] = {
- 1, 0, JAM1,62, 6, &topaz84, (UBYTE *)"File is an instrument!", NULL };
-
- UWORD Project0GTypes4[] = {
- INTEGER_KIND,
- BUTTON_KIND
- };
-
- struct NewGadget Project0NGad4[] = {
- 99, 36, 100, 14, (UBYTE *)"Enter an octave value (0-)", NULL, GD_Oct, PLACETEXT_ABOVE, NULL, NULL,
- 6, 57, 276, 14, (UBYTE *)"Ok", NULL, GD_Ok, PLACETEXT_IN, NULL, NULL
- };
-
- ULONG Project0GTags4[] = {
- (GTIN_Number), 0, (GTIN_MaxChars), 10, (TAG_DONE),
- (TAG_DONE)
- };
-
- int SetupScreen4( void )
- {
-
- if ( ! ( VisualInfo4 = GetVisualInfo( pubscreen, TAG_DONE )))
- return( 2L );
-
- return( 0L );
- }
-
- void CloseDownScreen4( void )
- {
- if ( VisualInfo4 ) {
- FreeVisualInfo( VisualInfo4 );
- VisualInfo4 = NULL;
- }
-
- }
-
- void Project0Render4( void )
- {
- UWORD offx, offy;
-
- offx = Project0Wnd4->BorderLeft;
- offy = Project0Wnd4->BorderTop;
-
- PrintIText( Project0Wnd4->RPort, Project0IText4, offx, offy );
- }
-
- int OpenProject0Window4( void )
- {
- struct NewGadget ng;
- struct Gadget *g;
- UWORD lc, tc;
- UWORD offx = pubscreen->WBorLeft, offy = pubscreen->WBorTop + pubscreen->RastPort.TxHeight + 1;
-
- if ( ! ( g = CreateContext( &Project0GList4 )))
- return( 1L );
-
- for( lc = 0, tc = 0; lc < Project0_CNT; lc++ ) {
-
- CopyMem((char * )&Project0NGad4[ lc ], (char * )&ng, (long)sizeof( struct NewGadget ));
-
- ng.ng_VisualInfo = VisualInfo4;
- ng.ng_TextAttr = &topaz84;
- ng.ng_LeftEdge += offx;
- ng.ng_TopEdge += offy;
-
- Project0Gadgets4[ lc ] = g = CreateGadgetA((ULONG)Project0GTypes4[ lc ], g, &ng, ( struct TagItem * )&Project0GTags4[ tc ] );
-
- while( Project0GTags4[ tc ] ) tc += 2;
- tc++;
-
- if ( NOT g )
- return( 2L );
- }
-
- if ( ! ( Project0Wnd4 = OpenWindowTags( NULL,
- WA_Left, Project0Left4,
- WA_Top, Project0Top4,
- WA_Width, Project0Width4,
- WA_Height, Project0Height4 + offy,
- WA_IDCMP, INTEGERIDCMP|BUTTONIDCMP|IDCMP_CLOSEWINDOW|IDCMP_REFRESHWINDOW,
- WA_Flags, WFLG_DRAGBAR|WFLG_DEPTHGADGET|WFLG_CLOSEGADGET|WFLG_SMART_REFRESH|WFLG_ACTIVATE,
- WA_Gadgets, Project0GList4,
- WA_Title, Project0Wdt4,
- WA_ScreenTitle, "EngClock Prefs",
- WA_PubScreen, pubscreen,
- TAG_DONE )))
- return( 4L );
-
- GT_RefreshWindow( Project0Wnd4, NULL );
-
- Project0Render4();
-
- return( 0L );
- }
-
- void CloseProject0Window4( void )
- {
- if ( Project0Wnd4 ) {
- CloseWindow( Project0Wnd4 );
- Project0Wnd4 = NULL;
- }
-
- if ( Project0GList4 ) {
- FreeGadgets( Project0GList4 );
- Project0GList4 = NULL;
- }
- }
-
- int getoct(int max) {
- struct IntuiMessage *msg;
- ULONG class,code,iaddress;
- char text[100], tmp[10];
-
- strcpy(text,"Enter an octave value (0-");
- sprintf(tmp,"%d",max);
- strcat(text,tmp);
- strcat(text,")");
-
- Project0NGad4[0].ng_GadgetText=text;
-
- SetupScreen4();
- OpenProject0Window4();
-
- GT_SetGadgetAttrs(Project0Gadgets4[GD_Oct],Project0Wnd4,NULL,GTIN_MaxChars,strlen(tmp),TAG_END);
- GT_RefreshWindow(Project0Wnd4,NULL);
-
- while(1) {
- Wait(1<<Project0Wnd4->UserPort->mp_SigBit);
- msg=(struct IntuiMessage *)GT_GetIMsg(Project0Wnd4->UserPort);
- code=msg->Code; class=msg->Class; iaddress=(ULONG)msg->IAddress;
- GT_ReplyIMsg(msg);
-
- switch(class) {
- case CLOSEWINDOW:
- CloseProject0Window4();
- CloseDownScreen4();
- return(0);
- break;
- case GADGETUP:
- case GADGETDOWN:
- if(gad(iaddress, max)) {
- CloseProject0Window4();
- CloseDownScreen4();
- return(oct);
- }
- break;
-
- }
- }
- }
-
- BOOL gad(ULONG iaddress, int max) {
- struct Gadget *gad2;
- struct StringInfo *si;
-
- gad2=(struct Gadget *)iaddress;
- si=(struct StringInfo *)gad2->SpecialInfo;
-
- switch(gad2->GadgetID) {
- case GD_Oct:
- if(si->LongInt > max || si->LongInt < 0) {
- DisplayBeep(NULL);
- GT_SetGadgetAttrs(Project0Gadgets4[GD_Oct],Project0Wnd4,NULL,GTIN_Number,oct,TAG_END);
- } else
- oct=si->LongInt;
- break;
- case GD_Ok:
- return(1);
- break;
- default:
- break;
- }
- return(0);
-
- }
-
-
-